package iotmonitor.system; //修改此处，你的包名称
import java.util.Scanner;

class test {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String choice = "1";
        FlowerList flowerlist = new FlowerList();
        System.out.println("**********鲜花管理系统********");
        while (choice.equals("0") == false) {
            System.out.println("1.添加鲜花");
            System.out.println("2.查看某个鲜花");
            System.out.println("3.统计花的总价钱,平均价钱,最高价钱和最低价钱");
            System.out.println("4.按价钱从高往低排序，并输出");
            System.out.println("5.统计高于平均价格和低于平均价格");
            System.out.println("0.退出程序");
            System.out.print("你的选择: ");
            choice = input.next();

            switch (choice) {
                case "0":
                    System.out.println("谢谢您的使用，欢迎下次光临！\n" + "**********按任意键结束程序**********");
                    break;


                case "1":
                    int i = 1;
                    do {
                        flowerlist.add();
                        System.out.println("\n是否继续添加？" + "\n" + "0.否" + "\n" + "1.是");
                        i = input.nextInt();
                    } while (i == 1);
                    System.out.println("请问您还需要什么服务？\n");
                    flowerlist.writeToFile("flower_data.txt");
                    break;
                case "2":
                    flowerlist.inquire();
                    System.out.println("请问您还需要什么服务？\n");
                    break;

                case "3":
                    flowerlist.average();
                    System.out.println("请问您还需要什么服务？\n");
                    break;

                case "4":
                    flowerlist.sort();
                    flowerlist.transcript();
                    System.out.println("请问您还需要什么服务？\n");
                    break;

                case "5":
                    flowerlist.classify();
                    System.out.println("请问您还需要什么服务？\n");
                    break;
                default:
                    System.out.println("请重新输入.");
                    break;
            }
        }
    }
}
